package com.hello.sandbox.fake.hook;

import com.hello.sandbox.SandBoxCore;
import java.lang.reflect.Method;

/** Created by Milk on 3/30/21. * ∧＿∧ (`･ω･∥ 丶　つ０ しーＪ 此处无Bug */
public abstract class MethodHook {
  protected String getMethodName() {
    return null;
  }

  protected Object afterHook(Object result) throws Throwable {
    return result;
  }

  protected Object beforeHook(Object who, Method method, Object[] args) throws Throwable {
    return null;
  }

  protected abstract Object hook(Object who, Method method, Object[] args) throws Throwable;

  protected boolean isEnable() {
    return SandBoxCore.get().isBlackProcess();
  }
}
